package com.atguigu.flink.datastreamapi.transform;

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;
import java.util.List;

/**
 * Created by Smexy on 2022/12/13
 */
public class Demo1_Map
{
    public static void main(String[] args) throws Exception {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.setParallelism(1);


        DataStreamSource<Integer> streamSource = env.fromElements(1, 2, 3, 4, 5, 6, 7);

        streamSource.map(new MapFunction<Integer, String>()
        {
            @Override
            public String map(Integer in) throws Exception {
                return "num:"+in;
            }
        }).print();

        env.execute();

    }
}
